<?php
header("Pragma: public");
header("Expires: 0");
header("Accept-Ranges: bytes");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-word");
header('Content-Disposition: attachment; filename=fbs.csv');
header("Content-Transfer-Encoding: binary");
foreach ($abiturients as $abiturient):
$passport_ser = str_split($abiturient['Abiturient']['passport_ser']);
array_splice($passport_ser, 2,1);
echo iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['lastname']).'%'.
     iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['firstname']).'%'.
     iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['surname']).'%'.
     iconv('UTF-8', 'Windows-1251', implode($passport_ser)).'%'.
     iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['passport_num']);
?>

<?php 
endforeach;
/*
 * 
iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['lastname'])
iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['firstname'])
iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['surname'])
iconv('UTF-8', 'Windows-1251', implode($passport_ser))
iconv('UTF-8', 'Windows-1251', $abiturient['Abiturient']['passport_num'])
 */
?>